<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<script type="text/javascript">
<!--
	$(document).ready(function() {
		$("#receipt").change(function() {
			if (2 == $(this).val()) {
				$("#receiptTypeArea").show();
			} else {
				$("#receiptTypeArea").hide();
			}
		});

		$("#addReceiptSelectionItem").click(function() {
			var tr = $("<tr></tr>").appendTo("#receiptSelectionTbody");
			var td1 = $("<td></td>").appendTo(tr);
			var td2 = $("<td></td>").appendTo(tr);
			var td3 = $("<td></td>").appendTo(tr);

			var inputName = $("<input type=text name='receiptItems_title'/>").appendTo(td1);
			var inputDesc = $("<input type=text name='receiptItems_description'/>").appendTo(td2);
			var btnDel = $("<input type=button value=删除 />").appendTo(td3);

			btnDel.click(function() {
				tr.remove();
			});
		});
	});
	
	function removeTr(it){
		$(it).parent().parent().remove();
	}
//-->
</script>
<TD class=list_td_gray width="19%" align="right" valign="top"
	rowspan="2">需要回执：</TD>
<TD class=list_td_white_line width="81%"><select name="receipt"
	id="receipt">
		<option value="0"
			<c:if test="${announcement.receipt eq 0}">selected</c:if>>不需回执</option>
		<option value="1"
			<c:if test="${announcement.receipt eq 1}">selected</c:if>>需回执</option>
		<option value="2"
			<c:if test="${announcement.receipt eq 2}">selected</c:if>>选项回复</option>
</TD>
<tr>
	<TD class=list_td_white_line id="receiptTypeArea"
		<c:if test="${announcement.receipt ne 2}">style="display: none"</c:if>>
	<table border=1 width="81%">
		<thead>
			<tr>
				<th>选项名称</th>
				<th width="60%">选项描述</th>
				<th width="120" nowrap="nowrap">操作&nbsp;&nbsp;<input type="button"
					id="addReceiptSelectionItem" value="添加选项" />
				</th>
			</tr>
		</thead>
		<tbody id="receiptSelectionTbody">
			<c:forEach var="varI" items="${announcement.receiptItems}">
				<tr>
					<td><input type=text name="receiptItems_title" value="${varI.title}"/></td>
					<td><input type=text name="receiptItems_description" value="${varI.description}"></td>
					<td><input type=button value=删除 onClick="removeTr(this)"/></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	</TD>
</tr>